package com.lsb.fitnessnutrition

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.navigation.Navigation
import com.lsb.fitnessnutrition.adapters.ViewPagerAdapter
import com.lsb.fitnessnutrition.tutorial.BenchTutorialFragment
import com.lsb.fitnessnutrition.tutorial.LiftTutorialFragment
import com.lsb.fitnessnutrition.tutorial.PlanTutorialFragment
import com.lsb.fitnessnutrition.tutorial.SquatTutorialFragment
import kotlinx.android.synthetic.main.activity_tutorial.*
import org.tensorflow.lite.examples.classification.R

class TutorialActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_tutorial)

        setUpTabs()
    }

    private fun setUpTabs(){
        val adapter = ViewPagerAdapter(supportFragmentManager)
        adapter.addFragment(SquatTutorialFragment(),"Squat")
        adapter.addFragment(BenchTutorialFragment(),"Bench")
        adapter.addFragment(LiftTutorialFragment(),"Lift")
        adapter.addFragment(PlanTutorialFragment(),"753Plan")
        viewPager.adapter = adapter
        //tabLayout关联viewPager
        tabs.setupWithViewPager(viewPager)

        tabs.getTabAt(0)!!.setIcon(R.drawable.ic_squat)
        tabs.getTabAt(1)!!.setIcon(R.drawable.ic_bench)
        tabs.getTabAt(2)!!.setIcon(R.drawable.ic_lift)
        tabs.getTabAt(3)!!.setIcon(R.drawable.ic_plan)
    }
}